<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="/js/vue.js"></script>
  <style>
    .btn{
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        color: #409eff;
        background: #ecf5ff;
        background-color: #b3d8ff;
        text-align: center;
        box-sizing: border-box;
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 4px;
    }
  </style>
</head>
<body>
  <div id="app">
    <counter inline-template>
        <button @click="num++">点击{{num}}次</button>
    </counter>
    <counter inline-template>
        <span class="btn" @click="num++">计数{{num}}次</span>
    </counter>
  </div>
<br>
  <script>
   Vue.component('counter',{
        data:function(){
            return{
                num:0
            }
        },
    template:'<button @click="num++">{{num}}次</button>'        
    })
   let app = new Vue({
   el:"#app"
    })
  </script>
</body>
</html>